package com.foreknow.moxi.controller;

import com.foreknow.moxi.model.Admin;
import com.foreknow.moxi.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;

@RestController
public class AdminController {

    @Autowired
    private AdminService adminService;

    @GetMapping("/admin/login")
    public Admin loginGet(Admin admin){
        Admin adminRes = adminService.findByNameAndPassword(admin);
        return adminRes;
    }

//    @RequestMapping("index")
//    public ModelAndView page1() {
//        return new ModelAndView("/index.html") ;
//    }
//
//    @RequestMapping("map")
//    public Map<String, String> map1() {
//        Map<String, String> map = new HashMap<String, String>();
//        map.put("name", "张三");
//        map.put("age", "28");
//        return map;
//    }
}